// 人脸采集
<template>
    <f7-page
        class="hntList"
        ptr
        @ptr:refresh="refresh"
        infinite
        :infinite-distance="50"
        :infinite-preloader="true"
        @infinite="infinite"
    >
        <f7-navbar>
            <f7-nav-left>
                <f7-link back icon-material="chevron_left" force></f7-link>
            </f7-nav-left>
            <f7-nav-title>人脸采集</f7-nav-title>
            <f7-nav-right> </f7-nav-right>
        </f7-navbar>
        <div class="search-box">
          <div class="company-box">
            <!-- <div class="left-box">安拆</div> -->
            <div class="right-box">
              <h4>{{entData.enterpriseName||'--'}}</h4>
              <span>{{entData.creditCode||'--'}}</span>
            </div>
          </div>
          <section>
            <div class="text-box">共<span>{{total||0}}</span>人</div>
            <van-search
              v-model="search.searchContent"
              @search="searchQuery"
              @clear="reset"
              shape="round"
              background="transparent"
              placeholder="请输入人员/联系方式"
            />
          </section>
        </div>
        <f7-list media-list class="search-list" v-if="query.data.length > 0">
            <li
                v-for="(item, index) in query.data"
                :key="index"
                @click="detail(item)"
            >
              <div class="left-box" v-if="!item.personPhotoAttachId">待采集</div>
              <img class="left-box" v-else :src="$util.getImgSrc(item.personPhotoAttachId)" />
              <div class="right-box">
                <section>
                  <h4>{{item.personName}}</h4>
                  <span class="tag tag-yellow-fill">{{item.personType|DictItem(controlData.personTypeEnum,'key','value')}}</span>
                </section>
                <span>联系方式：{{item.personMobile}}</span>
              </div>
            </li>
        </f7-list>
        <v-empty v-else description="暂无数据" />
    </f7-page>
</template>

<script>
import controller from '@/libs/framework/controller'
export default class instance extends controller {
    onBeforeInit() {
        this.urls = {
          model: ["/ent/entBase/getEntity","/ent/entPersonBase/getListModel"],
          query: '/ent/entPersonBase/query',
        }
    }

    onInit() {}
    onBeforeQuery(type, conditions, params) {
        if (type === 'list') {
        params.query.status=1
      }
    }
    onAfterQuery(type, isSuccess, result) {
      if(type=='form'){
        this.vm.entData=result.models.model
      }
      if(type=='list'){
        this.vm.total=result.recordsTotal
      }
      return result
    }
    mixin() {
        return {
            data() {
                return {
                  total:0,
                  entData:{},
                  search: {
                      searchContent: '',
                  },
                  query: {
                      data: [],
                  },
                }
            },
            methods: {
                // 详情
                detail(item) {
                    this.$f7router.navigate(
                        `/business/qzjx/face/create?personId=${item.personId}&pageAction=view`
                    )
                },
                reset() {
                    this.search.searchContent = ''
                    this.searchQuery()
                },
            },
        }
    }
}
</script>

<style lang="less" scoped>
@deep: ~'>>>';

@{deep}.page-content {
    background-color: #f4f6f9;
}

.hntList {
    .submit-btn {
        flex: 1;
        margin: 0 10px;
        border-radius: 24px;
    }

    .search-box {
        background-color: #f4f6f9;
        position: fixed;
        height: 130px;
        width: 100%;
        z-index: 99;
        box-sizing: border-box;
        section{
          display: flex;
          align-items: center;
          padding-left: 15px;
        }
        @{deep}.van-search{
            flex: 1;
            .van-search__content{
              background: #fff;
            }
        }
        @{deep}.searchbar {
            flex: 1;
            font-size: 16px;
            height: 35px;
            border-radius: 35px;
            overflow: hidden;
            margin-left: 16px;

            input[type='search'] {
                font-size: 16px;
                padding-left: 50px;
            }
        }

        > span {
            flex-shrink: 0;
            padding: 10px;
            width: 17px;
            height: 17px;
            background: url('../../../../assets/img/search.png') no-repeat center /
                17px;
        }

        .text-box{
          font-size: 13px;
          flex-shrink: 0;
          span{
            color: #4392ff;
            margin: 0 5px;
          }
        }
    }

    .search-list {
        margin: 135px 15px 20px;

        @{deep} ul {
            background: none;
        }

        li {
          margin: 10px 0;
          padding: 12px 15px;
          font-size: 13px;
          background: #ffffff;
          box-shadow: 0px 3px 8px 0px rgba(165, 201, 255, 0.1);
          border-radius: 8px;
          display: flex;
          align-items: center;
          &:first-child{
            margin-top: 0;
          }
          .left-box{
            width: 70px;
            height: 70px;
            background: #f0f6ff;
            text-align: center;
            line-height: 70px;
            margin-right: 15px;
            letter-spacing: 1px;
            font-size: 14px;
          }
          .right-box{
            height: 70px;
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            section{
              display: flex;
              span.tag.tag-yellow-fill{
                color: #f4b469;
                background: #fcf5e8;
                flex-shrink: 0;
                border: none;
                line-height: 20px;
              }
              h4{
                margin: 0;
                padding: 0;
                margin-right: 10px;
                font-size: 16px;
              }
            }
            span{
              color: #b5b5b5;
            }
          }
        }
    }

   .company-box{
      display: flex;
      align-items: center;
      background: #fff;
      padding: 15px 20px;
      .left-box{
        flex-shrink: 0;
        background: #e7fbfd;
        color: #4da7d5;
        border-radius: 6px;
        font-size: 15px;
        height: 50px;
        width: 50px;
        line-height: 50px;
        text-align: center;
        margin-right: 15px;
        letter-spacing: 1px;
      }
      .right-box{
        h4{
          font-size: 16px;
          margin: 0;
          padding: 0;
          margin-bottom: 5px;
        }
        span{
          color: #b5b5b5;
          font-size: 13px;
        }
      }
    }
}
</style>
